//
//  DiscoverView.swift
//  WechatApp
//
//  Created on 2024.
//

import SwiftUI

struct DiscoverView: View {
    var body: some View {
        NavigationView {
            List {
                NavigationLink(destination: MomentsView()) {
                    DiscoverRow(icon: "camera.fill", title: "朋友圈", color: .blue)
                }
                
                Divider()
                
                DiscoverRow(icon: "qrcode.viewfinder", title: "扫一扫", color: .blue)
                
                Divider()
                
                DiscoverRow(icon: "waveform", title: "摇一摇", color: .blue)
                
                Spacer()
                    .frame(height: 8)
                    .listRowInsets(EdgeInsets())
                
                DiscoverRow(icon: "eye.fill", title: "看一看", color: .orange)
                
                Divider()
                
                DiscoverRow(icon: "magnifyingglass", title: "搜一搜", color: .red)
            }
            .listStyle(.plain)
            .navigationTitle("发现")
            .navigationBarTitleDisplayMode(.inline)
        }
    }
}

struct DiscoverRow: View {
    let icon: String
    let title: String
    let color: Color
    
    var body: some View {
        HStack(spacing: 12) {
            Image(systemName: icon)
                .foregroundColor(color)
                .frame(width: 24)
            
            Text(title)
                .font(.system(size: 16))
            
            Spacer()
            
            Image(systemName: "chevron.right")
                .font(.system(size: 12))
                .foregroundColor(.secondary)
        }
        .padding(.vertical, 8)
    }
}

#Preview {
    DiscoverView()
}

